package com.zbkj.admin.controller;

import com.zbkj.admin.service.AdminInvoiceHandlerService;
import com.zbkj.common.constants.Constants;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.utils.CommonUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Objects;

/**
 * @Auther:
 * @Date: 2024/8/23 16:21
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("api/admin/invoice")
@Api(tags = "服务端发票服务")
public class AdminInvoiceController {

    @Autowired
    private AdminInvoiceHandlerService adminInvoiceHandlerService;


    @PostMapping("/invoicePdfParse")
    public CommonResult invoicePdfParse(@RequestPart("files") List<MultipartFile> files) {
        return CommonResult.success(adminInvoiceHandlerService.invoicePdfParse(files));
    }

    /**
     * 服务端给客户发发票
     * @param invoiceId
     * @return
     */
    @GetMapping("/invoicePush/{invoiceId}")
    public CommonResult invoicePush(@PathVariable("invoiceId") String invoiceId) {
        adminInvoiceHandlerService.invoicePush(invoiceId);
        return CommonResult.success();
    }

}
